#!/usr/bin/perl -w
use strict;
use Bio::SeqIO;
# run this program with
# perl pattern_match.pl CHS_seqs.fasta

my %patterns;

$patterns{CHS1} = 'MR[TS]TAD';

my $in = Bio::SeqIO->new(-format => 'fasta',
			 -file  => shift @ARGV);

while( my $seq = $in->next_seq ) {
    my ($id,$str) = ( $seq->id, $seq->seq);
    for my $pat ( keys %patterns ) {
	my $patv = $patterns{$pat};
	if( $str =~ /$patv/ ) {
	    print join("\t", $id,$patv),"\n";
	}
    }
}
